<script>
	top.document.getElementById("txt").innerHTML='Tag cleaning job started.';
	top.document.getElementById("progressBar").style.width='0px';
	top.document.getElementById("per").innerHTML='';
	top.document.getElementById("txt").innerHTML='';
</script>
<cfflush>

 <cfset lastProg=-1>
<cfquery  datasource="101tf2" name="getTags">
 
select  id from scanTags group by id 
 
</cfquery>


<cfoutput query="getTags">



<cfset prog=(currentrow*100) / recordcount >
<cfif lastProg neq #Round(prog)#>
<script>
	top.document.getElementById("progressBar").style.width='#Round(prog)*progressWidth#px';
	top.document.getElementById("per").innerHTML='#Round(prog)#% #currentrow# of #recordcount#';
</script>
<cfflush>

</cfif>  


 
<cfquery  datasource="101tf2" name="getOrphan">
select  id from scan
  where id ='#id#'
</cfquery>
<cfif not getOrphan.recordcount>
 <script>
	top.document.getElementById("txt").innerHTML='Clearing tags for #id#';
</script>
<cfquery  datasource="101tf2" name="delOrphan">
delete from scanTags where    id ='#id#'
</cfquery>
<cfflush>
</cfif>

<cfset lastProg=#Round(prog)#> 
</cfoutput>
 <script>
	top.document.getElementById("txt").innerHTML='Done';
</script>
 